package com.nuanshui.heatedloan.web.appsystem;

import com.alibaba.dubbo.config.annotation.Reference;
import com.nuanshui.heatedloan.constant.GlobalParam;
import com.nuanshui.heatedloan.msgcenter.facade.AppPushMsgService;
import com.nuanshui.heatedloan.msgcenter.form.AppPushMsgForm;
import com.nuanshui.heatedloan.msgcenter.vo.AppPushMsgVO;
import com.nuanshui.heatedloan.pageable.Pager;
import com.nuanshui.heatedloan.web.ApiController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cms/manage/apppushmsg")
public class AppPushMsgController extends ApiController{
	
	@Reference(url=GlobalParam.MSGCENTER_DUBBO_SERVER,timeout=GlobalParam.DUBBO_SERVER_TIME_OUT,version=GlobalParam.MSGCENTER_DUBBO_SERVER_VERSION )
	private AppPushMsgService appPushMsgService;
	
	@RequestMapping("/list")
	public String list(Pager<AppPushMsgVO> pager){
		pager = appPushMsgService.list(pager);
		return success(pager.asHashMap());
	}
	
	@RequestMapping("/create")
	public String create(AppPushMsgForm form){
		appPushMsgService.saveAndPush(form);
		//再发送推送
		return success();
	}
	
}
